#ifndef __FILE_H__
#define __FILE_H__

#include <stdio.h>
#include "CommandVariable.h"

class CommandVariable;
class File
{
public:
	void init_filesystem( void );
	int  filelength ( FILE *f );
	void create_path( char* path );
	void close_file ( FILE *f );
	int  open_file  ( char *filename, FILE **f );
	void read_file  ( void *buffer, int len, FILE *f );
	int  load_file  ( char *path, void **buffer );
	void free_file  ( void *buffer );
	void add_game_directory( char *dir );
	char *game_dir( void );
	void set_game_dir( char *dir );
	char **list_files( char *findname, int *numfiles, unsigned musthave, unsigned canthave );
	char *next_path  ( char *prev_path );

	// script commands
	void dir_f ( void );
	void path_f( void );
	void link_f( void );

private:
	CommandVariable::CVar* fs_basedir;
	CommandVariable::CVar* fs_cddir;
	CommandVariable::CVar* fs_gamedirvar;
	FileLink*        fs_links;
	SearchPath*      fs_searchpaths;
	SearchPath*      fs_base_searchpaths;
};

#endif